package com.treeliked.udpdemo.service;

import com.treeliked.udpdemo.cs.BaseClientServer;
import com.treeliked.udpdemo.model.Message;

import java.io.IOException;

/**
 * 发送接收消息接口
 *
 * @author lss
 * @date 2019-01-03, Thu
 */
public interface UdpService {

    /**
     * 发送消息
     *
     * @param msg 消息
     * @throws IOException io异常
     */
    void send(Message msg) throws IOException;

    /**
     * 允许接收消息
     *
     * @param cs 客户/服务端
     * @throws IOException io异常
     */
    void startReceive(BaseClientServer cs) throws IOException;

    /**
     * 停止接收消息
     *
     * @throws IOException io异常
     */
    void stopReceive() throws IOException;
}
